<?php $form=$this->beginWidget('booster.widgets.TbActiveForm',array(
	'id'=>'tramites-form',
	'enableAjaxValidation'=>false,
)); ?>

<p class="help-block">Fields with <span class="required">*</span> are required.</p>

<?php echo $form->errorSummary($model); ?>

	<?php echo $form->textFieldGroup($model,'titulo',array('widgetOptions'=>array('htmlOptions'=>array('class'=>'span5','maxlength'=>255)))); ?>

	<?php //echo $form->textFieldGroup($model,'categoria_id',array('widgetOptions'=>array('htmlOptions'=>array('class'=>'span5'))));
    $categoria = new Categorias();
            echo $form->dropDownListGroup($categoria,'id',
                                array(
                                        'wrapperHtmlOptions' => array(
                                                'class' => 'col-sm-5',
                                        ),
                                        'label'=>'Categoría',
                                        'widgetOptions' => array(
                                                //'id'=>'partida',
                                                //'name'=>'partida',
                                                'data' => CHtml::listData(Categorias::model()->findAll(),'id', 'nombre' ),
                                                //'options'=>array($model->proyecto_id => array('selected'=>true)),
                                                'htmlOptions' => array('id'=>'categoria', 'prompt' => 'Seleccionar categoría', //'onChange'=>'submit','submit' => array('/planificacion/importado','#'=>'partida') 
                                                                'ajax' => array(
                                                                'type'=>'POST', //request type
                                                                'url'=>CController::createUrl('administracion/bcat'), //url to call.
                                                                //Style: CController::createUrl('currentController/methodToCall')
                                                                'update'=>'#subcategoria', //selector to update
                                                                //'data'=>'js:javascript statement' 
                                                                //leave out the data key to pass all form values through
                                                                )),
                                        ),
                                        'hint' => 'Categoría del aviso.'
                                ));

            echo $form->dropDownListGroup($model,'sub_categoria_id',
                                array(
                                        'wrapperHtmlOptions' => array(
                                                'class' => 'col-sm-5',
                                        ),
                                        'label'=>'Sub Categoría',
                                        'widgetOptions' => array(
                                                //'id'=>'partida',
                                                //'name'=>'partida',
                                                'data' => array(),
                                                //'options'=>array($model->proyecto_id => array('selected'=>true)),
                                                'htmlOptions' => array('id'=>'subcategoria', 'prompt' => 'Seleccionar sub-categoría', //'onChange'=>'submit','submit' => array('/planificacion/importado','#'=>'partida') 
                                                                                                ),
                                        ),
                                        'hint' => 'Sub Categoría del aviso.'
                                ));
                                                                           ?>

	<?php //echo $form->textAreaGroup($model,'requisitos', array('widgetOptions'=>array('htmlOptions'=>array('rows'=>6, 'cols'=>50, 'class'=>'span8')))); ?>

	<?php //echo $form->textFieldGroup($model,'requerimientos',array('widgetOptions'=>array('htmlOptions'=>array('class'=>'span5','maxlength'=>255)))); ?>
	
	
	<?php 
		echo CHtml::label(CHtml::encode('Descripción '),'descripcion');
		$this->widget('application.extensions.eckeditor.ECKEditor', array(
                'model'=>$model,
                'attribute'=>'descripcion',
               //'label' => 'Descripción',
                'config' => array(
                    'toolbar'=>array(
                        array( 'Source', '-', 'Bold', 'Italic', 'Underline', 'Format', 'Font', 'FontSize', 'NumberedList', 'BulletedList',  'Strike', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'),
                        //array( 'Image', 'Link', 'Unlink', 'Anchor' ) ,
                    ),
                  ),
                ));
     ?>

	<?php //secho $form->datePickerGroup($model,'fecha_publicacion',array('widgetOptions'=>array('options'=>array('format'=>'yyyy-mm-dd'),'htmlOptions'=>array('class'=>'span5')), 'prepend'=>'<i class="glyphicon glyphicon-calendar"></i>', 'append'=>'Click on Month/Year to select a different Month/Year.')); ?>

	<?php //echo $form->textFieldGroup($model,'creado_por',array('widgetOptions'=>array('htmlOptions'=>array('class'=>'span5')))); ?>

	<?php //echo $form->textFieldGroup($model,'autorizado_por',array('widgetOptions'=>array('htmlOptions'=>array('class'=>'span5')))); ?>

	<?php if(Yii::app()->user->checkAccess('coordinador'))
            echo $form->checkBoxGroup($model,'publicado'); ?>

	<?php echo $form->textFieldGroup($model,'direccion',array('widgetOptions'=>array('htmlOptions'=>array('class'=>'span5','maxlength'=>255)))); ?>

	<?php echo $form->textFieldGroup($model,'horario',array('widgetOptions'=>array('htmlOptions'=>array('class'=>'span5','maxlength'=>255)))); ?>

<div class="form-actions">
	<?php $this->widget('booster.widgets.TbButton', array(
			'buttonType'=>'submit',
			'context'=>'primary',
			'label'=>$model->isNewRecord ? 'Create' : 'Save',
		)); ?>
</div>

<?php $this->endWidget(); ?>
